import Sequelize from 'sequelize'
import CONFIG from '../config'

const database = new Sequelize(CONFIG.DATABASE.DB, CONFIG.DATABASE.USERNAME, CONFIG.DATABASE.PASSWORD, {
    host: CONFIG.DATABASE.HOST,
    dialect: 'mysql',
    pool: {
        max: 5,
        min: 0,
        idle: 10000
    },
    logging : function(){},
    timezone: '+08:00'
})

export const User = database.import('./user.js')
export const Setting = database.import('./setting.js')
export const Order = database.import('./order.js')
export const Article = database.import('./article.js')
export const Template = database.import('./template.js')

export default database
